<template>
  <div class="content">
    <div class="left">
      <img style="width: 100%; height: 100%" src="../assets/logo.png" />
    </div>
    <div style="flex: 1">
      <div class="login_title">酒店管理系统{{params.usrNo}}</div>

      <div class="login_form">
        <div class="login_form_item">
          <div class="login_form_item_label">用户名：</div>
          <input v-model="params.usrNo" type="text" />
        </div>
        <div class="login_form_item">
          <div class="login_form_item_label">密 码：</div>
          <input v-model="params.passwod" type="password" />
        </div>
        <div class="login_form_item">
          <button @click="doLogin()">登录</button>
          <button style="margin-left: 10px">重置</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "login",
  components: {},
  computed: {},
  data() {
    return {
      params: {
        usrNo: "",
        passwod: "",
      },
    };
  },
  methods: {
    doLogin() {
      axios({
        baseURL: "/api",
        method: "post",
        url:"/login/login",
        params: this.params,// String usrNo, String passwod
          // data: this.params, @RequestBody LoginDto login
      }).then(res => {
        console.info(res);
        if(res.data=='登录成功'){
          this.$router.push("/home/index")
        }else{
          alert(res.data)
        }
      });
    },
  },
};
</script>

<style>
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

.content {
  display: flex;
  flex-direction: row;
  height: 100%;
}
.left {
  width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login_title {
  display: flex;
  font-size: 32px;
  font-weight: bold;
  height: 200px;
  align-items: center;
  justify-content: center;
}
.login_form {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.login_form_item {
  display: flex;
  margin-bottom: 10px;
}
.login_form_item_label {
  display: flex;
  justify-content: flex-end;
  width: 80px;
}
</style>
